package com.codeape.number.base.mvvm.bindingadapter.ListView;

import android.view.View;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;

import androidx.databinding.BindingAdapter;

/**
 * ListView的ViewBindingAdapter
 *
 * @author LiuPeiming
 * Created at 2018/10/27 15:40
 */
public final class ViewBindingAdapter {

    /**
     * 设置adapter
     *
     * @param view    ListView
     * @param adapter FragmentPagerAdapter
     */
    @BindingAdapter({"adapter"})
    public static void setAdapter(ListView view, BaseAdapter adapter) {
        view.setAdapter(adapter);
    }

    /**
     * 设置adapter
     *
     * @param view    ListView
     * @param adapter FragmentPagerAdapter
     */
    @BindingAdapter({"itemClick"})
    public static void setOnItemClickListener(ListView view, BaseAdapter adapter) {
        view.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            }
        });
    }

}